home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * %%File: rtfhtml.c
- *
- * Copyright (c) 1995-1999 Bertrand LE QUELLEC
- *
- * http://perso.wanadoo.fr/blq
- * blq@wanadoo.fr
- */
-
-
- #include <stdio.h>
-
- #ifndef UNIX_SRC
- #include <string.h>
- #endif
-
- #include "html.h"
- #include "rtftype.h"
- #include "rtfdecl.h"
- #include "rtfreadr.h"
- #include "rtfchar.h"
-
- #define SOURCE_RTFHTML 1
- #include "rtfhtml.h"
-
-
-
- /*
- * %%Function: HexaToHtmlOrTxt.
- *
- * Determine le caractere RTF et le transcrit en caractere HTML ou a
- * defaut en caractere TXT et l'envoie en sortie via la fonction
- * ecPrintChar()
- */
- int HexaToHtmlOrTxt(char * code, int param, bool fParam)
- {
- char TabHexa[10];
- char * tok = (char *)0;
- int i = 0;
-
-
- if(fParam == fFalse)
- sprintf(TabHexa, "%c%c", code[1], param);
- else
- sprintf(TabHexa, "%c%d", code[1], param);
-
- if((tok = HexaToHTML(TabHexa)))
- {
- modeSpecial = 1;
-
- for(i = 0; i < (int)strlen(tok); i++)
- {
- if(ecPrintChar((int)tok[i]) != ecOK)
- return ecNO;
- }
-
- modeSpecial = 0;
-
- return ecOK;
- }
- else
- return ecPrintChar(chHexaToAscii(TabHexa));
- }
-
-
- /*
- * %%Function: HexaToHtmlToHexa.
- *
- * Determine le caractere RTF et le transcrit en caractere HTML
- * pour le retranscrire en RTF, et l'envoie a en sortie via la
- * fonction ecPrintChar()
- *
- * Cette operation permet d'utiliser les tables de correspondance
- * HEXA/HTML qui prennent en compte les codes HEXA du Mac, ou les
- * anciens codes HEXA utilises par des versions anterieures a Word 6.0
- */
- int HexaToHtmlToHexa(char * code, int param, bool fParam)
- {
- char TabHexa[10];
- int valHexa = 0;
-
-
- if(fParam == fFalse)
- sprintf(TabHexa, "%c%c", code[1], param);
- else
- sprintf(TabHexa, "%c%d", code[1], param);
-
- if((valHexa = chHexaToAscii(HTMLToHexa(HexaToHTML(TabHexa)))) != ecNO)
- return ecPrintChar(valHexa);
- else
- return ecPrintChar(chHexaToAscii(TabHexa));
- }
-
-